﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="register.aspx.cs" Inherits="KeDa2025_.register" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>首页-后台管理</title>
	<link href="css/style.css" rel="stylesheet">
<link href="css/font.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
	<script>
		//验证账号是否有用
        function sendAjax() {
            // 1. 获取用户输入的内容
            var account = document.getElementById("txtAccount").value;
            // 2. 发起 AJAX 请求
            var xhttp = new XMLHttpRequest(); // 创建对象
            // 配置异步请求参数：请求方式、接口地址、是否异步
            xhttp.open("GET", "CheckAccountHandler.ashx?Account=" + account, true);
            // AJAX 请求发送
            xhttp.send();
            // 回调函数
            xhttp.onreadystatechange = function () {
                if (this.readyState == 4 && this.status == 200) {
                    // 获取接口的响应文本
                    var result = xhttp.responseText;
                    console.log(result); // 检查结果是否是预期的 "true" 或 "false"

                    // 业务代码
                    var sp = document.getElementById("sp1");
                    if (result == "true") {
                        sp.style.display = "none";
                    } else {
                        sp.style.display = "block";
                    }
                }
            };
        }



		
        function checkPwd() {
            var pwd = document.getElementById("txtPwd").value;
            var rpwd = document.getElementById("txtRPwd").value;
            console.log("密码:", pwd, "重复密码:", rpwd); // 检查密码内容

            if (pwd !== rpwd) {
                alert("两次密码不一致，请检查！");
                return false;
            } else {
                return true; // 密码一致
            }
        }



    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div class="log_banner">
    	<div class="inset">
		<h1>用户注册</h1>
		<p>Connect the real world and the internet world!</p>
	</div>
     	   
  </div>
  <!--注册开始-->
  <div id="body">
	<div id="reg_box" class="left">
		<div method="post" action="/" role="form" autocomplete="on">
         <div class="my-group">
			<span class="left" >账号</span>
			 <asp:TextBox ID="txtAccount" class="form-control put1" runat="server" onkeyup="sendAjax()" placeholder="请输入用户名"  maxlength="14"></asp:TextBox><span id="sp1" style="color:red; display:none ">该账号已存在!</span>
		</div>
        
        
        <div class="my-group">
			<span class="left" >生日</span>
			<asp:TextBox ID="txtBirday" class="form-control put1" runat="server" placeholder="请输入出生日期"  maxlength="14"></asp:TextBox>
			
		</div>
        
        <div class="my-group">
			<span class="left" >密码</span>
			<asp:TextBox ID="txtPwd" class="form-control put1" runat="server" placeholder="请输入密码"  maxlength="14"></asp:TextBox>
		</div>
        
        <div class="my-group">
			<span class="left" >重复密码</span>
			<asp:TextBox ID="txtRPwd" class="form-control put1" runat="server" placeholder="请再次输入密码"  maxlength="14"></asp:TextBox>
		</div>
        
          <div class="my-group">
			<span class="left" >所在城市</span>
			  <asp:DropDownList ID="ddlCity" class="form-control put1" runat="server"  maxlength="14">
			 
</asp:DropDownList>
		</div>
        
			
						<div class="my-group">
	              <span class="left" >性别&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
							<asp:RadioButtonList ID="ratnGender"  class="form-control put2" runat="server" RepeatDirection="Horizontal">
						       	<asp:ListItem Value="0">男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</asp:ListItem>
							<asp:ListItem Value="1">女</asp:ListItem>
								</asp:RadioButtonList>
                    </div>

        <div class="my-group">
			<span class="left" >上传头像&nbsp;&nbsp;&nbsp;</span>

			<asp:FileUpload ID="fileUpImg"  class=" form-control put1 put2" placeholder="上传头像" runat="server"  />
			
			<asp:Button ID="btUpload" runat="server" Text="上传头像" OnClick="Button1_Click" style="margin-left: 110px;"/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- 添加一些空格 -->
			<asp:Image ID="Image1" runat="server" Height="55px" Width="55px" />
			
		</div>
        
         <div class="my-group">
			<span class="left" >手机</span>
			 <asp:TextBox ID="txtPhone"  class="form-control put1" placeholder="手机"  maxlength="11" runat="server"></asp:TextBox>
			
		</div>
        
         <div class="my-group">
			<span class="left" >邮箱</span>
			 <asp:TextBox ID="txtEmail"  class="form-control put1" placeholder="邮箱"   runat="server"></asp:TextBox>
			
		</div>
         <div class="my-group">
			<span class="left" >QQ</span>
			 <asp:TextBox ID="txtQq"  class="form-control put1" placeholder="QQ"  maxlength="12" runat="server"></asp:TextBox>
			
		</div>
        
        <div class="form-actions">
			
				<p><input id="cb_clause" type="checkbox" checked="checked">我已经仔细阅读并同意<a href="#" target="_blank">《服务条款》</a>中的相关事项。</p>

			<asp:Button ID="btLogin" class="btn-primary btn" runat="server" Text="注册康辉账号" OnClientClick="return checkPwd();" OnClick="btLogin_Click" />
				
              
				</div>
        
        
      
        
       
        
        
        
        </div>
		
	</div>
    
	<div class="side_box right">
		<h2>帐号与您的设备</h2>
		<p>
		感谢您的关注并准备注册为康辉用户。
		</p>
		<p>不想注册？ <a href="login.html"><i class="icon-weibo"></i>快速登录</a> </p>
		<p>
		作为一家传感器云网络提供商，我们致力于将您身边的物体接入互联网，并使您能方便地通过互联网或者移动设备了解他们的状态、控制他们。除了我们提供的硬件设备外，您也可以设计自己的传感器硬件，并通过<a href="" target="_blank">开放API</a>免费接入。
		</p>
		
	</div>
</div>
    </form>
</body>
</html>
